﻿Imports System.Web
Imports AutoCAD

''' <summary>
''' CAD图元数据
''' </summary>
Public Interface ICadEntityDataService

    ''' <summary>
    ''' 是工件
    ''' </summary>
    ''' <param name="ent"></param>
    ''' <returns></returns>
    Function IsPart(ByRef ent As AcadEntity) As Boolean

    Function IsPart(layer As String, objectName As String) As Boolean
    ''' <summary>
    ''' 是板件
    ''' </summary>
    ''' <param name="ent"></param>
    ''' <returns></returns>
    Function IsPlate(ByRef ent As AcadEntity) As Boolean

    Function IsPlate(layer As String, objectName As String) As Boolean
    ''' <summary>
    ''' 是加工
    ''' </summary>
    ''' <param name="ent"></param>
    ''' <returns></returns>
    Function IsWork(ByRef ent As AcadEntity) As Boolean

    ''' <summary>
    ''' 是块引用
    ''' </summary>
    ''' <returns></returns>
    Function IsBlockReference(ByRef ent As AcadEntity) As Boolean

    Function IsBlockReference(objectName As String) As Boolean

    ''' <summary>
    ''' 是多段线
    ''' </summary>
    ''' <returns></returns>
    Function IsPL(ByRef ent As AcadEntity) As Boolean
    Function IsPL(objectName As String) As Boolean

    ''' <summary>
    ''' 是圆形
    ''' </summary>
    ''' <returns></returns>
    Function IsCircle(ByRef ent As AcadEntity) As Boolean
    Function IsCircle(objectName As String) As Boolean
    ''' <summary>
    ''' 是线段
    ''' </summary>
    ''' <returns></returns>
    Function IsLine(ByRef ent As AcadEntity) As Boolean
    Function IsLine(objectName As String) As Boolean
    ''' <summary>
    ''' 是圆弧
    ''' </summary>
    ''' <returns></returns>
    Function IsArc(ByRef ent As AcadEntity) As Boolean
    Function IsArc(objectName As String) As Boolean

    ''' <summary>
    ''' 是点
    ''' </summary>
    ''' <param name="ent"></param>
    ''' <returns></returns>
    Function IsPoint(ByRef ent As AcadEntity) As Boolean
    Function IsPoint(objectName As String) As Boolean

    ''' <summary>
    ''' 是三维实体
    ''' </summary>
    ''' <param name="ent"></param>
    ''' <returns></returns>
    Function IsSolid(ByRef ent As AcadEntity) As Boolean
    Function IsSolid(objectName As String) As Boolean

    ''' <summary>
    ''' 是否包含
    ''' </summary>
    ''' <param name="bbox"></param>
    ''' <param name="centroid"></param>
    ''' <returns></returns>
    Function IsContain(ByRef centroid As Double(), ByRef bbox As Double(,))
    Function IsContain(centroid As Double(), ByRef minp As Double(), ByRef maxp As Double())
    Function IsContain(ByVal centroidX As Double, ByVal centroidY As Double, ByVal centroidZ As Double, ByRef minp As Double(), ByRef maxp As Double())

    ''' <summary>
    ''' 获取图元数据
    ''' </summary>
    ''' <param name="ents"></param>
    ''' <returns></returns>
    Function GetEntiyData(ByRef ents As IEnumerable) As DataTable

    ''' <summary>
    ''' 构建图元数据表, 包含图元基础信息、包围盒、质心
    ''' </summary>
    ''' <returns></returns>
    Function BuildDataTable_EntityData() As DataTable

    ''' <summary>
    ''' 构建工件数据表
    ''' </summary>
    ''' <returns></returns>
    Function BuildDataTable_PartData() As DataTable
    ''' <summary>
    ''' 获取图元对象包围盒尺寸
    ''' </summary>
    ''' <param name="ent"></param>
    ''' <returns></returns>
    Function GetSize(ByRef ent As AcadEntity)
    Function GetSize(ByRef minp As Double(), ByRef maxp As Double())


    ''' <summary>
    ''' 获得图元质心
    ''' </summary>
    ''' <param name="bbox"></param>
    ''' <returns></returns>
    Function GetCentroid(ByRef bbox As Double(,)) As Double()

    ''' <summary>
    ''' 获得图元质心
    ''' </summary>
    ''' <param name="ent"></param>
    ''' <returns></returns>
    Function GetCentroid(ByRef ent As AcadEntity) As Double()

    ''' <summary>
    ''' 获得图元包围盒
    ''' </summary>
    ''' <param name="ent"></param>
    ''' <returns></returns>
    Function GetBBox(ByRef ent As AcadEntity) As Double(,)

    ''' <summary>
    ''' 创建并填充工件数据
    ''' </summary>
    ''' <param name="ents"></param>
    ''' <returns></returns>
    Function CreatePartDataTable(ByRef ents As IEnumerable) As DataTable

    ''' <summary>
    ''' 填充工件数据
    ''' </summary>
    ''' <param name="dt"></param>
    ''' <param name="ents"></param>
    Sub FillPartDataTable(ByRef dt As DataTable, ByRef ents As IEnumerable)

    ''' <summary>
    ''' 获取工件尺寸
    ''' </summary>
    ''' <param name="ent"></param>
    ''' <returns></returns>
    Function GetPartSize(ByRef part As AcadBlockReference)

End Interface
